package br.com.async.core.infrastructure;

import org.hibernate.Criteria;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.Restrictions;

import br.com.async.core.domain.enterprise.Enterprise;
import br.com.async.core.domain.enterprise.EnterpriseRepository;

public class EnterpriseRepositoryImpl extends AbstractRepositoryImpl<Enterprise, Integer> implements EnterpriseRepository{

	public EnterpriseRepositoryImpl() {
		super(Enterprise.class);
	}

	@Override
	public Enterprise findByUrl(String url) {
		
		Criteria criteria = getSession().createCriteria(Enterprise.class);
		Criterion c1 = Restrictions.eq("url", url);
		
		criteria.add(c1);
		return (Enterprise) criteria.uniqueResult();
	}

	

}
